package com.oocl.dataprocess.action;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Comparator;

import com.oocl.command.ParseCommand;
import com.oocl.dataprocess.comparator.IdComparator;
import com.oocl.dataprocess.filter.Impl.FilterRex;
import com.oocl.dataprocess.parser.Impl.ParseTxT;
import com.oocl.dataprocess.pojo.Customer;
import com.oocl.dataprocess.printer.Printer;

public class DataProcessAction {
	
	public void action() throws IOException{
		ParseCommand paseComamnd = new ParseCommand();
		ServerSocket server = new ServerSocket(8888);
		Socket socket = server.accept();
		OutputStream out = socket.getOutputStream();
		InputStream in =socket.getInputStream();
		out.write("please put your command..".getBytes());
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		String info = null;
		while(true){
			info = reader.readLine();
			String infomation = paseComamnd.parseCommand(info);
			out.write(infomation.getBytes());
			out.write(("please put your command"+"\n\r").getBytes());
		}
		
		
	}
	
	public static void main(String[] args) throws Exception{
		new DataProcessAction().action();
	}
}
